/*
 * CGSTransitions.h
 *
 * Created by Joe Ranieri on 7/23/07.
 * Copyright 2007 Alacatia Labs. All rights reserved.
 *
 */

#pragma once
#include "CGSConnection.h"

typedef int CGSTransitionObj;

typedef enum {
	kCGSTransitionNone,
	kCGSTransitionFade,
	kCGSTransitionZoom,
	kCGSTransitionReveal,
	kCGSTransitionSlide,
	kCGSTransitionWarpFade,
	kCGSTransitionSwap,
	kCGSTransitionCube,
	kCGSTransitionWarpSwitch,
	kCGSTransitionFlip
} CGSTransitionType;

typedef enum {
	/*! Directions for the transition. Some directions don't apply to some transitions. */
	kCGSTransitionDirectionLeft = 1 << 0,
	kCGSTransitionDirectionRight = 1 << 1,
	kCGSTransitionDirectionDown = 1 << 2,
	kCGSTransitionDirectionUp = 1 << 3,
	kCGSTransitionDirectionCenter = 1 << 4,
	
	/*! Reverses a transition. Doesn't apply for all transitions. */
	kCGSTransitionFlagReversed = 1 << 5,
	
	/*! Ignore the background color and only transition the window. */
	kCGSTransitionFlagTransparent = 1 << 7,
} CGSTransitionFlags;

typedef struct {
	int unknown; // always set to zero
	CGSTransitionType type;
	CGSTransitionFlags option;
	CGSWindowID wid; /* 0 means a full screen transition. */
	float *backColor; /* NULL means black. */
} CGSTransitionSpec;

CG_EXTERN_C_BEGIN

/*! Creates a new transition from a `CGSTransitionSpec`. */
CG_EXTERN CGError CGSNewTransition(CGSConnectionID cid, const CGSTransitionSpec *spec, CGSTransitionObj *outTransition);

/*! Invokes a transition asynchronously. Note that `duration` is in seconds. */
CG_EXTERN CGError CGSInvokeTransition(CGSConnectionID cid, CGSTransitionObj transition, float duration);

/*! Releases a transition. */
CG_EXTERN CGError CGSReleaseTransition(CGSConnectionID cid, CGSTransitionObj transition);

CG_EXTERN_C_END
